<template>
    <div class="updater">
        <n-progress type="circle" :percentage="percentage" />
    </div>
</template>

<script setup lang="ts">
import { onMounted, ref } from 'vue'
const percentage = ref(0)

onMounted(() => {
  // 发送请求
// window.electron.ipcRenderer.send('update-percentage', 'ping')
// 监听主进程返回响应的频道
window.electron.ipcRenderer.on('update-percentage', (_event, progress) => {
  console.log('收到下载进度:', progress) // 输出: 收到下载进度: 1 ~ 100
  percentage.value = progress.percent
})
})
</script>
<style lang="scss" scoped>
.updater {
  .n-progress {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
  }
}
</style>